package com.yxhl.zoume.domain.interactor.tripsmgmt;

import com.yxhl.zoume.data.http.repository.tripsmgnt.TripsRepository;
import com.yxhl.zoume.data.http.rest.param.base.RequestParamImpl;
import com.yxhl.zoume.data.http.rest.param.tripsmgnt.CommentDriverParam;
import com.yxhl.zoume.data.http.rest.response.tirps.CommentDriverResponse;
import com.yxhl.zoume.domain.DomainConstants;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * Created by sugarya on 16/4/5.
 */
public class CommentDriverUseCase extends com.yxhl.zoume.domain.interactor.base.UseCase<CommentDriverResponse> {

    private TripsRepository tripsRepository;

    @Inject
    public CommentDriverUseCase(@Named(DomainConstants.UI_THREAD) Scheduler uiThread,
                                @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread,
                                TripsRepository tripsRepository) {
        super(uiThread, executorThread);
        this.tripsRepository = tripsRepository;
    }

    @Override
    protected Observable<CommentDriverResponse> buildObservable(RequestParamImpl param) {
        return tripsRepository.commentOnTripDriver((CommentDriverParam) param)
                .subscribeOn(executorThread)
                .observeOn(uiThread);
    }
}
